import request from '@/core/request/index'

// 登录记录
export const loginLog = (account, name, email) => {
  return request({
    url: '/llog/loginLog',
    method: 'POST',
    data: {
      account, name, email
    }
  })
}

// 操作记录
export const operationLog = (operation_person, operation_content, operation_level) => {
  return request({
    url: '/olog/operationLog',
    method: 'POST',
    data: {
      operation_person, operation_content, operation_level
    }
  })
}

// 返回登录日志列表
export const loginLogList = () => {
  return request({
    url: '/llog/loginLogList',
    method: 'POST',
  })
}

// 返回操作日志列表
export const operationLogList = () => {
  return request({
    url: '/olog/operationLogList',
    method: 'POST',
  })
}

// 返回最近十条登录日志
export const searchLoginLogList = (account) => {
  return request({
    url: '/llog/searchLoginLogList',
    method: 'POST',
    data: {
      account
    }
  })
}

// 返回最近十条操作日志
export const searchOperationLogList = (operation_person) => {
  return request({
    url: '/olog/searchOperationLogList',
    method: 'POST',
    data: {
      operation_person
    }
  })
}


// 返回登录日志列表的长度
export const loginLogListLength = () => {
  return request({
    url: '/llog/loginLogListLength',
    method: 'POST',
  })
}

// 返回操作日志列表的长度
export const operationLogListLength = () => {
  return request({
    url: '/olog/operationLogListLength',
    method: 'POST',
  })
}

// 监听换页返回数据
export const returnLoginListData = (pager) => {
  return request({
    url: '/llog/returnLoginListData',
    method: 'POST',
    data: {
      pager
    }
  })
}

export const returnOperationListData = (pager) => {
  return request({
    url: '/olog/returnOperationListData',
    method: 'POST',
    data: {
      pager
    }
  })
}

// 清空登录日志
export const clearLoginLogList = () => {
  return request({
    url: '/llog/clearLoginLogList',
    method: 'POST',
  })
}

// 清空操作日志
export const clearOperationLogList = () => {
  return request({
    url: '/olog/clearOperationLogList',
    method: 'POST',
  })
}
